package net.kazed.nextaction.context.activity;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import net.kazed.nextaction.R;
import net.kazed.nextaction.database.GtdContext;

public class ContextListItemView extends LinearLayout {
   
	private TextView name;
   private TextView numberOfTasks;

	public ContextListItemView(Context androidContext, int viewResourceId) {
		super(androidContext);
		
        LayoutInflater vi = (LayoutInflater) androidContext.
        		getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        vi.inflate(viewResourceId, this, true); 
        
		name = (TextView) findViewById(R.id.name);
      numberOfTasks = (TextView) findViewById(R.id.number_of_tasks);
	}

	/**
	 * Update view.
	 * @param context Display this context in view.
	 * @param isSelected
	 */
	public void updateView(GtdContext context) {
      name.setText(context.getName());
      numberOfTasks.setText(Integer.toString(context.getNumberOfTasks()));
   }

}
